package com.atguigu.mystarter.auto;

import com.atguigu.mystarter.bean.MyStarterProperties;
import com.atguigu.mystarter.service.MyStarterService;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@ConditionalOnMissingBean(MyStarterService.class)//当组件中没有的时候  才放入该组件
@EnableConfigurationProperties(MyStarterProperties.class)//开启属性绑定功能 默认放在容器中
public class MyStarterServiceAutoConfiguration {
    public MyStarterServiceAutoConfiguration(){

    }

    @Bean
    public MyStarterService myStarterService(){
        return new MyStarterService();
    }

}
